//模型创建 https://www.sequelize.com.cn/core-concepts/model-basics#%E5%AD%97%E7%AC%A6%E4%B8%B2

//关于访客信息
module.exports = (sequelize, DataTypes) => {
    return sequelize.define("user",
        {
            userId: {
                type: DataTypes.UUID,
                autoIncrement: true,
                notNull: true,
                primaryKey: true,
                field: 'user_id',
            },
            realname: {
                type: DataTypes.STRING,
                notEmpty: true,
                notNull: true,
                field: 'real_name',
                comment: '真实用户名',
            },
            username: {
                type: DataTypes.STRING,
                notEmpty: true,
                notNull: true,
                field: 'user_name',
                comment: '用户名',
            },
            password: {
                type: DataTypes.STRING,
                notEmpty: true,
                notNull: true,
                field: 'user_pwd',
                comment: '密码',
            },
            villageId: {
                type: DataTypes.INTEGER,
                field: 'village_id',
                comment: '村落id',
            },
            role: {
                type: DataTypes.STRING,
                comment: '角色',
            },
        },
        {
            // 不要createAt、updateAt字段
            timestamps: false,
            tableName: 'user'
        }
    );
};
